/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author sflesca
 */
@Entity
public class Ordine implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    @ManyToOne
    private Cliente cliente;

    /**
     * Get the value of string
     *
     * @return the value of string
     */
    public Cliente getCliente() {
        return cliente;
    }

    /**
     * Set the value of string
     *
     * @param string new value of string
     */
    public void setCliente(Cliente c) {
        this.cliente = c;
    }
    
    @OneToMany(mappedBy = "ordine")
    private List<DettaglioOrdine> dettagliordine = new LinkedList<DettaglioOrdine>();

    /**
     * Get the value of dettagliordine
     *
     * @return the value of dettagliordine
     */
    public List<DettaglioOrdine> getDettagliordine() {
        return dettagliordine;
    }

    /**
     * Set the value of dettagliordine
     *
     * @param dettagliordine new value of dettagliordine
     */
    public void setDettagliordine(List<DettaglioOrdine> dettagliordine) {
        this.dettagliordine = dettagliordine;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ordine)) {
            return false;
        }
        Ordine other = (Ordine) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Ordine[id=" + id + "]";
    }

}
